<?


require_once  $_SERVER['DOCUMENT_ROOT']."/../_lib/base/common.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.template.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holidays.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.destinations.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.weather.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.hotels.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.photos.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.reviews.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.lurls.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.tree.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.breadcrumb.php";


	$template = new template();
	$destinations = new destinations();
	$hotels = new hotels();
	$lurls = new lurls();
	$tree = new tree();
	$reviews = new reviews();
	$photos = new photos();
	$breadcrumb = new breadcrumb();
	
	
	// get the hotel values
	$params['tree_id'] = $_GET['tree_id'];
	$params['cache']['seconds'] = '2400';
	$hotel_values = $tree->get_branch($params);
	$hotel_values = $hotel_values[0];
	unset($params);
	
	// If not found then send to 404 error
	if(!$hotel_values){
		header("HTTP/1.0 404 Not Found"); 
		include($_SERVER['DOCUMENT_ROOT']."/404.php");
		exit;
	}
	
	// get photos
	$cache['cache']['seconds'] = '2400';
	$hotel_photos = $photos->get_photos($hotel_values['tree_id'], $cache);
	unset($cache);
	
	// get photo url
	$lead_hotel_thumb_url = $tree->photo_url($hotel_values['main_photo']);
	
	// Get resort
	$params['tree_id'] = $hotel_values['parent_id'];
	$params['cache']['seconds'] = '2400';
	$resort_values = $tree->get_branch($params);
	$resort_values = $resort_values[0];
	unset($params);
	
	//Get destination
	$params['tree_id'] = $resort_values['parent_id'];
	$params['cache']['seconds'] = '2400';
	$destination_values = $tree->get_branch($params);
	$destination_values = $destination_values[0];
	unset($params);
	
	// Get reviews
	$params['tree_id'] = $hotel_values['tree_id'];
	$params['status'] = 'a';
	$params['cache']['seconds'] = '2400';
	$hotel_reviews = $reviews->get_review_average($params);
	if($hotel_reviews){
		$hotel_reviews_list = $reviews->get_reviews($params);
	}
	// Get LURL of the reviews
	$lurl_review_add = $lurls->get_hotel_review_add_lurl($params['tree_id']);
	// Get LURL of the reviews
	$lurl_review_read = $lurls->get_hotel_review_lurl($params['tree_id']);
	unset($params);
	
	

	// Template
	$template->title = $hotel_values['name'].", ".$resort_values['name'].", ".$destination_values['name'].", book online";
	$template->meta_keywords = $hotel_values['name'].", ".$resort_values['name'].", ".$destination_values['name'].", book online, hotel, reviews, holiday";
	$template->meta_description = "Book ".$hotel_values['name'].", ".$resort_values['name'].", ".$destination_values['name']." online and read reviews";
	$template->section_highlight = "guides";
	$template->left_col = true;
	$template->breadcrumbs_html = $breadcrumb->get_html_breadcrumb($hotel_values['lineage']);	
	
	$template->ld_head();
	
	
	
	
	


?>







<h2 title="<?= $hotel_values['name'] ?>"><?= $hotel_values['name'].", ".$resort_values['name'].", ".$destination_values['name'] ?></h2>




<!-- Start hotel details -->
<div class="box_margin">


<div class="col_110">

<?
if($hotel_photos){
?>

<div class='thumb_cover_div'>
<a id="main-thumb-ref" href="#"><img src="<?= $lead_hotel_thumb_url ?>" alt="<?= $hotel_values['name'] ?>" class="thumb_image_100" /><img src="/images/thumb_cover_100_74.gif" class="thumb_cover" alt="<?= $destination['name'] ?>" /></a></div>

<?
}
?>



</div>







<div class="col_310">


<p class="title_big"><?= $hotel_values['name'] ?></p>
<p class="title_med"><?= $resort_values['name'].", ".$destination_values['name'] ?></p>


<!-- Start rating -->
<p class="no_margin"><? if($hotel_values['hotel_rating']) echo output_rating($hotel_values['hotel_rating'], "star", true); ?>&nbsp;</p>
<!-- End rating -->



<!-- Start review link -->
<? if($hotel_reviews){ ?>
<p class="no_margin"><?= output_rating($hotel_reviews['0']['overall'], "rate", true); ?> <a id="read-review" href="<?= $lurl_review_read ?>">Read reviews (<?= $hotel_reviews[0]['num_reviews'] ?>)</a></p>
<? }elseif(!empty($hotel_values['tree_id'])){ ?>
<p class="no_margin">This hotel has not been reviewed <a href="<?= $lurl_review_add ?>">Write a review</a></p>
<? } ?>
<!-- End review link -->





</div>






<div class="col_190" style="background-color:#3388CC">



<!-- Start send 2 + bookmark box -->
<div class="box_lb_190_cap">
<div class="box_lb_190_shoe">
<div class="padding_10">

<ul class="blank_list">
	<li class="link_fav"><a href="javascript:addToFavorites('<?= $template->title ?>', '<?= MAIN_SITE_ROOT.$_SERVER['REQUEST_URI'] ?>')">Bookmark this page</a></li>
</ul>

</div>
</div>
</div>
<!-- End send 2 + bookmark box -->




</div>



<div class="clearing"></div>



</div>
<!-- End hotel details -->








<?

// Display the details tabs

// Show / hide accommodation
$show_accommodation = true;

// Show / hide photos
if($hotel_photos){
	$show_photos = true;
}

// Show / hide map
if($hotel_values['address']){
	$show_map = true;
}

// Show / hide reviews
if($hotel_reviews){
	$show_reviews = true;
	$num_reviews = $hotel_reviews['num_reviews'];
}else{
	$num_reviews = 0;
	$show_reviews = true;
}


include SITE_ROOT_PATH."/_lib/html/hotel_details_tabs.php";


$template->ld_foot();

?>